@page "/Waterfall_Chart"

<Waterfall Data=data1 Config="config1" />

<Divider>动手实验</Divider>
<DynamicExample @ref="@example">
    <Waterfall @ref="@chart" />
</DynamicExample>

@code{

    public IChartComponent chart;
    DynamicExample example;

    protected override void OnAfterRender(bool firstRender)
    {
        base.OnAfterRender(firstRender);
        example.Chart = chart;
    }


    #region 示例1

    object[] data1 = new object[] {
        new  { type= "日用品", money= 120 },
        new  { type= "伙食费", money= 900 },
        new  { type= "交通费", money= 200 },
        new  { type= "水电费", money= 300 },
        new  { type= "房租", money= 1200 },
        new  { type= "商场消费", money= 1000 },
        new  { type= "应酬红包", money= -2000 },
};

    WaterfallConfig config1 = new WaterfallConfig()
    {
        Padding = "auto",
        XField = "type",
        YField = "money",
        Meta = new
        {
            Type = new
            {
                Alias = "类别",
            },
            Money = new
            {
                Alias = "金额",
            },
        },
    };


    #endregion 示例1

}

